import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'index.dart';

class HomePage extends GetView<HomeController> {
  const HomePage({super.key});

  // 主视图
  Widget _buildView() {
    return Center(
      child: OutlinedButton(
        onPressed: () {
          Get.toNamed("/guide");
        },
        child: Text("guide"),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<HomeController>(
      init: HomeController(),
      id: "home",
      builder: (_) {
        return Scaffold(
          appBar: AppBar(
            title: const Text("home"),
            actions: [
              IconButton(
                onPressed: () {
                  Get.toNamed("/setting");
                },
                icon: Icon(Icons.settings),
              ),
            ],
          ),
          body: SafeArea(child: _buildView()),
        );
      },
    );
  }
}
